package com.steven.im.ui.activity;

import android.content.Intent;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.steven.im.R;
import com.steven.im.adapter.IMGroupAdapter;
import com.steven.im.adapter.IMGroupChatListAdapter;
import com.steven.im.base.BaseActivity;
import com.steven.im.entity.IMGroupChatListEntity;
import com.steven.im.utils.TitleBuilder;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class IMGroupListActivity extends BaseActivity {
    @BindView(R.id.iv_title_right)
    ImageView ivTitleRight;
    @BindView(R.id.rc_group)
    RecyclerView rc_group;
    @BindView(R.id.tv_count)
    TextView tvCount;
    private List<IMGroupChatListEntity>  contentList=new ArrayList<>();
    @Override
    public void setListen() {

    }

    @Override
    public void setTitleBarColor() {
        ivTitleRight.setImageResource(R.drawable.icon_search);
        new TitleBuilder(this).setTitleText(getString(R.string.group_chat))
                .setLeftIcoListening(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        finish();
                    }
                });
    }

    @Override
    public int intiLayout() {
        return R.layout.activity_im_grouplist;
    }

    @Override
    public void initView() {
        contentList.clear();
        for (int i=0;i<6;i++){
            IMGroupChatListEntity imGroupChatListEntity=new IMGroupChatListEntity();
            imGroupChatListEntity.setGroup_name("群聊");
            contentList.add(imGroupChatListEntity);
        }
        tvCount.setText((contentList.size()+"个群聊"));
        LinearLayoutManager manager = new LinearLayoutManager(this);
        IMGroupChatListAdapter imGroupChatListAdapter= new IMGroupChatListAdapter(contentList);
        rc_group.setLayoutManager(manager);
        rc_group.setAdapter(imGroupChatListAdapter);
        imGroupChatListAdapter.setOnItemClickListener(new IMGroupChatListAdapter.OnItemClickListener() {
            @Override
            public void onClick(int position) {
                //点击事件
                startActivity(new Intent(IMGroupListActivity.this,IMGroupInfoActivity.class));
            }

            @Override
            public void onLongClick(int position) {

            }
        });
    }

    @Override
    public void initData() {

    }
}
